﻿#ifndef AppMonitorTask_H
#define AppMonitorTask_H
#include <QString>
#include "Runable.h"
#include "Logger.h"
#include "appmonitor.h"
#include "common.h"
#include "apprunninginfo.h"

typedef enum
{
    AppRunningState_unknown,
    AppRunningState_starting,
    AppRunningState_running,
    AppRunningState_stopping,
    AppRunningState_stopped

}AppRunningState;


class AppMonitorTask  : public Runable
{
public:
    AppMonitorTask(const AppMonitor & appMonitor);
    virtual ~AppMonitorTask();
    virtual bool isAppRunning();
    virtual bool isMemOverLoad();
    virtual int start();

    void stopAppByForce();

    int getPid();

    void startApp();

    void changeAppRunningState(AppRunningState state);

    QString sayState();

    AppRunningInfo getCurrentRunningInfo();


    AppMonitor appMonitor;


    //bool needStop;

private:

    AppRunningState appRunningState;

};


#endif // AppMonitorTask_H
